<?php

namespace app\mini\controller\v1\client;

use app\common\library\exception\ApiException;
use app\common\library\MemberVo;
use app\common\library\Upload;
use app\common\logic\ServiceLogic;
use app\common\logic\UsedCarLogic;
use app\mini\controller\Common;
use think\Config;
use think\Env;
use think\Request;
use think\response\Json;

class UsedCar extends Common
{

    public $UsedCarLogic;

    public function __construct(Request $request = null)
    {
        parent::__construct($request);
        $this->UsedCarLogic = new UsedCarLogic();
    }

    /**
     * 二手车列表
     * @return Json
     */
    public function index()
    {
        $res = $this->exception(function () {
            return $this->UsedCarLogic->index(request()->param('','','htmlspecialchars'));
        });
        return $this->response($res);
    }

    /**
     * 二手车编辑/添加
     * @return Json
     */
    public function edit()
    {
        $res = $this->exception(function () {
            return $this->UsedCarLogic->car_edit(request()->param());
        });
        return $this->response($res);
    }

    /**
     * 获取二手车信息
     * @return Json
     */
    public function info()
    {
        $res = $this->exception(function () {
            return $this->UsedCarLogic->info(request()->param());
        });
        return $this->response($res);
    }

    /**
     * 获取二手车详情
     * @return Json
     */
    public function detail()
    {
        $res = $this->exception(function () {
            return $this->UsedCarLogic->detail(request()->param());
        });
        return $this->response($res);
    }


    /**
     * 我的二手车列表
     * @return Json
     */
    public function my_index()
    {
        $res = $this->exception(function () {
            $params = request()->param();
            $params['member_id'] = MemberVo::instance()->getMemberId();
            $params['type'] = 1;
            return $this->UsedCarLogic->my_index($params);
        });
        return $this->response($res);
    }




}
